#include "AVLTree.h"
#include <string>

void test1()
{
	AVLTree<int, string> a;
	a.Insert(make_pair(2, "left"));
	a.Insert(make_pair(1, "right"));
	a.Insert(make_pair(5, "up"));
	a.Insert(make_pair(3, "down"));
	a.Insert(make_pair(4, "down"));


	//cout << a.IsAVLTree() << endl;
	a.InOrder();
}

void test2()
{
	//int arr[] = { 4,2,6,1,3,5,15,7,16,14 };
	int arr[] = { 16,3,7,11,9,26,18,14,15 };
	AVLTree<int, int> a;
	for (auto e : arr)
	{
		a.Insert({ e,e });
	}
	cout << "height-> :" << a.Height() << endl;
	cout << "size-> :" << a.Size() << endl;
	cout << a.IsAVLTree() << endl;
	cout << a.Size() << endl;
	a.InOrder();

}

void test3()
{
	AVLTree<int, int> a;
	srand((unsigned int)time(0));
	int N = 1000;
	size_t ret1 = clock();
	for (size_t i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.Insert({ num,num });
	}
	size_t ret2 = clock();

	size_t ret3 = clock();
	/*for (size_t i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.Find(num);
	}*/
	size_t ret4 = clock();
	cout << "height-> :" << a.Height() << endl;
	cout << "size-> :" << a.Size() << endl;
	cout << "insert->time : " << ret2 - ret1 << endl;
	//cout << "Find->time : " << ret4 - ret3 << endl;
	cout << " : " << a.IsAVLTree() << endl;
	//a.InOrder();
}

void test4()
{
	AVLTree<int, int> a;
	for (size_t i = 0; i < 100; i++)
	{
		a.Insert({ i,i });
	}
	cout << " : " << a.IsAVLTree() << endl;
	a.InOrder();


}

void test5()
{
	AVLTree<int,int> a;
	a.Insert({ 5,5 });
	a.Insert({ 2,2 });
	a.Insert({ 6,6 });
	a.Insert({ 1,1 });
	a.Insert({ 3,3 });
	a.Insert({ 4,4 });
	a.InOrder();
	cout << a.IsAVLTree() << endl;
}

int main()
{
	//test1();
	//test2();
	test3();

	//test4();

	//test5();

	return 0;
}